/*
区间前缀和
*/
#define quickread
#ifdef quickread
#include <cstdio> 
template <typename T>
inline void read(T& x)
{
    int c=getchar(), f=1; x=0;
    while(c<'0'||'9'<c) {if(c=='-') f=-1; c=getchar();}
    while('0'<=c&&c<='9') 
        x=(x<<3)+(x<<1)+c-'0', c=getchar();
    x*=f;
}
template <typename T>
inline void quickwrite(T x)
{
    if(x>=10) quickwrite(x/10);
    putchar(x%10+'0');
}
#else 
#include <iostream>
#endif
#include <algorithm>
using namespace std;
#define DEBUG

const int N=1e5+10;
int n, t;
int a[N];
int ans;

void init()
{
    read(n), read(t);
    for(int i=1; i<=n; i++) read(a[i]);
} 


void solve()
{
    init();
    int i=1, j=0, sum=0; //i指向区间左端点，j指向区间右端点
    while(i<=n&&j<=n-1)
    {
        sum+=a[++j];
        while(sum>t) sum-=a[i++];
        ans=max(ans, j-i+1);
        // printf("%d %d %d\n", i, j, sum);
    }

    
    quickwrite(ans), puts("");
}

// #undef DEBUG
signed main()
{
    #ifdef DEBUG
        freopen("../in.txt", "r", stdin);
        freopen("../out.txt", "w", stdout);
    #endif
    #ifndef quickread
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    #endif

    int T=1; //scanf("%d", &T);
    while(T--) 
    {
        solve();
    }
    return 0;
}